home *** CD-ROM | disk | FTP | other *** search
- /*
- HEADER: CUG nnn.nn;
- TITLE: LEX - A Lexical Analyser Generator
- VERSION: 1.0 for IBM-PC
- DATE: Jan 30, 1985
- DESCRIPTION: A Lexical Analyser Generator. From UNIX
- KEYWORDS: Lexical Analyser Generator YACC C PREP
- SYSTEM: IBM-PC and Compatiables
- FILENAME: LEX.H
- WARNINGS: This program is not for the casual user. It will
- be useful primarily to expert developers.
- CRC: N/A
- SEE-ALSO: YACC and PREP
- AUTHORS: Scott Guthery 11100 leafwood lane Austin, TX 78750
- COMPILERS: DESMET-C
- REFERENCES: UNIX Systems Manuals
- */
- /*
- * Bob Denny 28-Aug-82 Remove reference to FILE *lexin to
- * eliminate dependency on standard I/O library. Only
- * lexgetc() used it, and it's there now.
- * Add EOF definition for standalone uses.
- * Corrected comment for llnxtmax.
- *
- * Scott Guthery 20-Nov-83 Adapt for IBM PC & DeSmet C. Removed
- * equivalence of yylval and lexval since
- * a multi-typed parser wants yylval to be
- * typed to be the union of the types (YYSTYPE).
- */
-
- /*
- * lex library header file -- accessed through
- * #include <lex.h>
- */
- #define _H_LEX
-
- #include <stdio.h>
- #ifdef THINK_C
- #define SHORTINT short
-
- #include "LEXLIBPROTO.H"
-
- #else
- #define SHORTINT int /* who uses this */
- #endif
-
- /*
- * Description of scanning tables. The entries at the front of
- * the struct must remain in place for the assembler routines to find.
- */
- struct lextab {
- SHORTINT llendst; /* Last state number */
- unsigned char *lldefault; /* Default state table */
- unsigned char *llnext; /* Next state table */
- unsigned char *llcheck; /* Check table */
- SHORTINT *llbase; /* Base table */
- SHORTINT llnxtmax; /* Last in next table */
- SHORTINT (*llmove)(); /* Move between states */
- SHORTINT *llfinal; /* Final state descriptions */
- SHORTINT (*llactr)(); /* Action routine */
- SHORTINT *lllook; /* Look ahead vector if != NULL */
- unsigned char *llign; /* Ignore char vec if != NULL */
- unsigned char *llbrk; /* Break char vec if != NULL */
- unsigned char *llill; /* Illegal char vec if != NULL */
- SHORTINT llresid; /* resource ID of lextab */
- SHORTINT llresinit; /* lextab rsrc loaded from id ? */
-
- };
-
- typedef struct LEXT {
- SHORTINT rfinal; /* id's of various resources */
- SHORTINT rnext;
- SHORTINT rcheck;
- SHORTINT rdefault;
- SHORTINT rbase;
- SHORTINT rlook;
- SHORTINT rign;
- SHORTINT rbrk;
- SHORTINT rill;
- SHORTINT nstates; /* nr of states */
- SHORTINT nnext; /* nr of entries in llnext */
- } LEXT, *LEXTPtr, **LEXTHandle;
-
- #define NBPW 16
- #define LEXERR 256
- #define LEXSKIP (-1)
- #ifndef EOF
- #define EOF (-1)
- #endif
- #ifndef NULL
- #define NULL (0)
- #endif
- #define LEXECHO(fp) {lexecho((fp));}
-
- #define lextext llbuf
- #define lexlast llend
-
- #ifndef THINK_C
- extern FILE lexin;
- #else
- extern FILE *lexin;
- #endif
-
- extern char *llbuf;
- extern SHORTINT llbufsize;
-